package com.zjgk.hotel.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import com.zjgk.hotel.dao.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("select id,username,head_img,phone,role from user where phone = #{phone} limit 1  ")
    public User getUserByPhone(String phone);

    @Select("select id,username,head_img,phone,role,login_date from user where id = #{id} limit 1  ")
    public User getUserInfo(long id);

    @Select("select id from user where wx_code = #{wxCode} limit 1  ")
    public Long getWxCodeById(String wxCode);

    @Select("select salt from user where username = #{username} limit 1  ")
    public int getSaltByUsername(String username);

    @Select("select id,username,head_img,phone,role,login_date from user where (username = #{username} and password = #{pwd} and role = 1)")
    public User adminLogin(String username,String pwd);
}
